package com.zlsy.learning.leetcode.arraycorrelation.array1512;


/**
 * @author zhouliang
 * @date 2020/7/13 21:19
 */
public class NumIdenticalPairs {
    public static int numIdenticalPairs(int[] nums) {
        int ans = 0;
        int[] temp = new int[100];
        for (int num : nums) {
            ans += temp[num - 1]++;
        }
        return ans;
    }

    public static void main(String[] args) {
        int[] nums = new int[]{1, 2, 3, 1, 1, 3};
        int i = numIdenticalPairs(nums);
        System.out.println(i);
    }
}
